package Callable;

import java.util.Scanner;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) {
        System.out.println("Enter the number:");
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        Callable<String> c1 = new MyCallable(n);
        FutureTask<String> task = new FutureTask<>(c1);
        new Thread(task).start();
    }
}
class MyCallable implements Callable<String>{
    private  int n;
    public MyCallable(int n){
        this.n = n;
    }
    @Override
    public String call() throws Exception {
        int s=0;
        for(int i=1;i<=n;i++){
            s+=i;
        }
        return "结果是："+s;
    }
}
